package net.sunofbeaches.dao;

import net.sunofbeaches.pojo.Category;
import net.sunofbeaches.pojo.FriendLink;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;


public interface FriendLinkDao extends JpaRepository<FriendLink, String>, JpaSpecificationExecutor<FriendLink> {
    int deleteAllById(String friendLinkId);

    FriendLink findOneById(String friendLinkId);

    @Query(nativeQuery = true, value = "SELECT * FROM `tb_friends` WHERE `state` = ? ORDER BY `create_time` DESC ")
    List<FriendLink> listFriendLinkByState(String status);
}
